package cn.springbak.publish.Service.impl;


import cn.springbak.publish.Service.SysLogService;
import cn.springbak.publish.common.annotation.RequiredLog;
import cn.springbak.publish.dao.SysLogDao;
import cn.springbak.publish.pojo.SysLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysLogServiceImpl implements SysLogService {
    @Autowired
    private SysLogDao sysLogDao;
    @Async    //调用spring框架内置线程池的一个线程
    @Override
    public void saveLog(SysLog sysLog) {
        String tName = Thread.currentThread().getName();
        System.out.println(tName);

        sysLogDao.insertLog(sysLog);
    }
    @RequiredLog(operation = "删除日志")
    @Override
    public int deleteById(Long... ids) {
        return sysLogDao.deleteById(ids);
    }

    @Override
    public SysLog findById(Long id) {
        return sysLogDao.selectById(id);
    }

    @Override
    public List<SysLog> findLogs(SysLog sysLog) {
        return sysLogDao.selectLogs(sysLog);
    }
}
